<?php

namespace App\Http\Requests\Customers;

use App\Http\Requests\BasicFormRequests;

class CustomersRequests extends BasicFormRequests
{
    protected $rule =[
        'phone' => 'required',
        'captcha' => 'required',
        'key' => 'required',
        'email' => 'required',
        'code' => 'required',
        'account' => 'required',
        'password' => 'required',
        'wx_union_id' => 'required',
        'wx_open_id' => 'required',
    ];

    public function __construct(array $query = [], array $request = [], array $attributes = [], array $cookies = [], array $files = [], array $server = [], $content = null)
    {
        $this->message = [
            'phone.required'=>trans('message.request_required',[
                'name' => trans('key.phone')
            ]),
            'captcha.required'=>trans('message.request_required',[
                'name' => trans('key.captcha')
            ]),
            'key.required'=>trans('message.request_required',[
                'name' => trans('key.key')
            ]),
            'code.required'=>trans('message.request_required',[
                'name' => trans('key.sms_code')
            ]),
            'email.required'=>trans('message.request_required',[
                'name' => trans('key.email')
            ]),
            'account.required'=>trans('message.request_required',[
                'name' => trans('key.account')
            ]),
            'password.required'=>trans('message.request_required',[
                'name' => trans('key.password')
            ])
        ];
        parent::__construct($query, $request, $attributes, $cookies, $files, $server, $content);
    }


    protected $scene = [
        'phone' => ['code','phone'],
        'accountRegister' => ['account','password','captcha','key'],
        'wxRegister' => ['leader_id|user_id_has']
    ];
}
